1
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <style type=
"text/css">
23 This sample demonstrates how to run a WCF Workflow Service on Windows Azure. It
24 uses Visual Studio
2008 and WF
3.5.
</p>
26 While currently Windows Azure platform AppFabric does not contain a Workflow
27 Service component, you can run WCF Workflow Services directly in a Windows Azure
28 Web Role. By default, a Web Role runs under full trust, so it supports the
29 workflow environment.
</p>
31 The workflow in this sample contains a single ReceiveActivity. It compares the
32 service operation
's parameter
's value with
20, and returns
"You
've entered a
33 small value.
" and
"You
've entered a large value.
", respectively. The client
34 application invokes the Workflow Service twice, passing a value less than
20,
35 and a value grater than
20, respectively.
</p>
39 For this sample to work, you must install the Windows Azure SDK and the Windows
40 Azure Tools for Visual Studio. This sample works on the local Developer Fabric
41 (included in the Windows Azure SDK) and also in the Windows Azure cloud service.
42 To run the sample in the cloud service, you must also have a valid Windows Azure
43 account. More information about Windows Azure can be found here:
44 <a href=
"http://msdn.microsoft.com/en-us/library/dd179367.aspx">
45 http://msdn.microsoft.com/en-us/library/dd179367.aspx
</a>. Please note that the Windows Azure SDK also has
46 a number of its own pre-requisites (including IIS and SQL Server).
</p>
48 Running the Sample
</h2>
50 You must start Visual Studio in elevated (administrator) mode. Right-click on Visual
51 Studio and then click Run as Administrator. This is required by the Windows Azure
52 simulation environment.
</p>
54 Configure the app.config file for the the Client application:
</p>
56 <!-- Modify address if you host the workflow service in the cloud, or if your Development Fabric is not listening on port 81. -->
57 <endpoint address=
"http://127.0.0.1:81/ProcessDataWorkflowService.svc"
58 binding=
"basicHttpBinding" bindingConfiguration=
"BasicHttpBinding_IProcessDataWorkflow"
59 contract=
"WorkflowServiceReference.IProcessDataWorkflow" name=
"BasicHttpBinding_IProcessDataWorkflow" />
60 <!-- Modify address if you host the workflow service in the cloud, or if your Development Fabric is not listening on port 81. -->
61 <endpoint address=
"http://127.0.0.1:81/ProcessDataWorkflowService.svc"
62 binding=
"basicHttpBinding" bindingConfiguration=
"BasicHttpBinding_IProcessDataWorkflow"
63 contract=
"WorkflowServiceReference.IProcessDataWorkflow" name=
"BasicHttpBinding_IProcessDataWorkflow" />
64 <!-- Modify address if you host the workflow service in the cloud, or if your Development Fabric is not listening on port 81. -->
65 <endpoint address=
"http://127.0.0.1:81/ProcessDataWorkflowService.svc"
66 binding=
"basicHttpBinding" bindingConfiguration=
"BasicHttpBinding_IProcessDataWorkflow"
67 contract=
"WorkflowServiceReference.IProcessDataWorkflow" name=
"BasicHttpBinding_IProcessDataWorkflow" />
68 <!-- Modify address if you host the workflow service in the cloud, or if your Development Fabric is not listening on port 81. -->
69 <span style=
"font-size:
70 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">
71 <span style=
"mso-tab-count:5">
72 </span><!--
</span><span style=
"font-size:10.0pt;font-family:"Courier New";color:green;mso-no-proof:
73 yes"> Modify address if you host the Workflow Service in the cloud, or if your
74 Development Fabric is not listening on port
81.
</span>
75 <span style=
"font-size:
76 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">--
><o:p></o:p></span></p>
78 <span style=
"font-size:
79 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">
80 <span style=
"mso-spacerun:yes">
81 </span><</span><span style=
"font-size:
82 10.0pt;font-family:"Courier New";color:#A31515;mso-no-proof:yes">endpoint
</span><span
83 style=
"font-size:10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">
85 <span style=
"font-size:10.0pt;font-family:"Courier New";color:red;
86 mso-no-proof:yes">address
</span><span style=
"font-size:10.0pt;font-family:"Courier New";
87 color:blue;mso-no-proof:yes">=
</span><span style=
"font-size:10.0pt;font-family:
88 "Courier New";mso-no-proof:yes">"<span style=
"color:blue">http://
127.0.0.1:
81/ProcessDataWorkflowService.svc
</span>"<o:p></o:p></span></p>
90 <span style=
"font-size:
91 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">
92 <span style=
"mso-spacerun:yes">
94 <span style=
"font-size:
95 10.0pt;font-family:"Courier New";color:red;mso-no-proof:yes">binding
</span><span
96 style=
"font-size:10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">=
</span><span
97 style=
"font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes">"<span
98 style=
"color:blue">basicHttpBinding
</span>"<span style=
"color:blue"> </span>
99 <span style=
"color:red">bindingConfiguration
</span><span style=
"color:blue">=
</span>"<span
100 style=
"color:blue">BasicHttpBinding_IProcessDataWorkflow
</span>"<o:p></o:p></span></p>
101 <p class=
"MsoNormal">
102 <span style=
"font-size:
103 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">
104 <span style=
"mso-spacerun:yes">
106 <span style=
"font-size:
107 10.0pt;font-family:"Courier New";color:red;mso-no-proof:yes">contract
</span><span
108 style=
"font-size:10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes">=
</span><span
109 style=
"font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes">"<span
110 style=
"color:blue">WorkflowServiceReference.IProcessDataWorkflow
</span>"<span
111 style=
"color:blue"> </span><span style=
"color:red">name
</span><span
112 style=
"color:blue">=
</span>"<span style=
"color:blue">BasicHttpBinding_IProcessDataWorkflow
</span>"<span
113 style=
"color:blue"> /
></span></span><endpoint address=
"http://127.0.0.1:81/ProcessDataWorkflowService.svc"
114 binding=
"basicHttpBinding" bindingConfiguration=
"BasicHttpBinding_IProcessDataWorkflow"
115 contract=
"WorkflowServiceReference.IProcessDataWorkflow" name=
"BasicHttpBinding_IProcessDataWorkflow" /></p>
117 Then run the VBAZWorkflowService35 project in the Windows
118 Azure local Developer Fabric or package and deploy the solution to the Windows Azure
119 service. For more information about running Windows Azure applications locally or
120 in the cloud please refer to the Windows Azure documentation at
121 <a href=
"http://msdn.microsoft.com/en-us/library/ee405484.aspx">
122 http://msdn.microsoft.com/en-us/library/ee405484.aspx
</a>.
</p>
124 Finally, run the Client project to verify the workflow service works properly.
</p>
128 The sample solution contains
4 projects.
</p>
130 VBAZWorkflowService35
</h3>
132 The cloud service project. When testing in Development Fabric, please make sure
133 to run this project instead of the WorkflowServiceWebRole project.
</p>
135 WorkflowServiceWebRole
</h3>
137 The Web Role project. It is a normal ASP.NET project that hosts a WCF Workflow
138 Service. Hosting a Workflow Service in Windows Azure is the same as hosting in
139 IIS. The WorkflowServiceHostFactory handles all the work for you.
</p>
140 <p class=
"MsoNormal">
141 <span style=
"font-size: 10.0pt; line-height: 115%; font-family: "Courier New"; background: yellow; mso-highlight: yellow; mso-no-proof: yes">
142 <%
</span><span style=
"font-size:10.0pt;line-height:115%;font-family:"Courier New";color:blue;
143 mso-no-proof:yes">@
</span><span style=
"font-size:10.0pt;line-height:115%;
144 font-family:"Courier New";color:#A31515;mso-no-proof:yes">ServiceHost
</span><span style=
"font-size:10.0pt;line-height:115%;font-family:"Courier New";mso-no-proof:
145 yes"> <span style=
"color:red">language
</span><span style=
"color:blue">=
"VB
"</span>
146 <span style=
"color:red">Debug
</span><span style=
"color:blue">=
"true
"</span>
147 <span style=
"color:red">Service
</span><span style=
"color:blue">=
"WFServiceLibrary.ProcessDataWorkflowService
"</span>
148 <span style=
"color:red">Factory
</span><span style=
"color:blue">=
"System.ServiceModel.Activation.WorkflowServiceHostFactory
"</span>
149 <span style=
"background: yellow; mso-highlight: yellow">%
></span></span><o:p></o:p></p>
151 There
's also nothing special about configuration. For this sample, we
'll use
152 BasicHttpBinding.
</p>
154 WFServiceLibrary
</h3>
156 A standard WFServiceLibrary project, where the actual workflow is composed.
157 Please note WF
4 has a much more sophisticated programming model compared to WF
158 3.5. So it is recommended to use WF
4's new programming model for new
159 developments. However, currently Windows Azure only supports .NET
3.5. To make
160 it easier to migrate to WF
4 in the future, this sample takes the XOML approach
161 rather than the code only approach.
</p>
165 A console client application that invokes the WCF Workflow Service.
</p>